﻿using HDW_Migrate.Resources;
using HDW_Migrate.Extensions;
using Microsoft.AspNetCore.Mvc;

namespace HDW_Migrate.Controllers;

/// <summary>
/// 配置
/// </summary>
/// <param name="logger"></param>
[ApiController]
[Route("[controller]")]
public class SettingController(ILogger<SettingController> logger)
{
    /// <summary>
    /// 保存连接配置
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public string Save(SystemSettingDto dto)
    {
        dto.Save();
        return "设置成功：" + dto.ToJson();
    }

    /// <summary>
    /// 读取连接配置
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    public SystemSettingDto Get() => SystemSettingDto.Read();
}


